/**
 * Student Name: Thong, Wang Kit Wilson (50419704)
 *               Yin, Xing (51590277)
 */
#ifndef LOG_H
#define LOG_H

#include <stdarg.h>
#include <string.h>
#include <stdio.h>
#include "SqlDb.h"

#ifndef __func__
#define __func__ __FUNCTION__
#endif

//#ifndef LOG_OUT
//#define LOG_OUT stdout
//#endif


/**
 * Create a table in a default database for writing logs
 */
extern void LogDebug (const char*, char* filename, int linenum);
extern void LogInfo (const char*, char* filename, int linenum);
extern void LogWarn (const char*, char* filename, int linenum);
extern void LogErr (const char*, char* filename, int linenum);

#define FUNC_LOG(msg) char __funcName__[101] = ""; \
                      LogDebug (strcat(strcat(__funcName__, __func__),"()"), __FILE__, __LINE__)
#define DEBUG_LOG(msg) LogDebug (msg, __FILE__, __LINE__)
#define INFO_LOG(msg) LogInfo (msg, __FILE__, __LINE__)
#define WARN_LOG(msg) LogWarn (msg, __FILE__, __LINE__)
#define ERR_LOG(msg) LogErr (msg, __FILE__, __LINE__)
#endif
